home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 24
/
AMIGAplus Sonderheft 24 (2000)(Falke)(DE)[!].iso
/
PublicDomain
/
Anwendungen
/
MT-RechnungIII
/
Rexx
/
FWAngebot2.outrexx
< prev
next >
Wrap
Text File
|
1998-11-26
|
11KB
|
503 lines
/*
** Druck-, Vorschau, Sichern des Angebots mit Hilfe von FinalWriter
** $VER: FWAngebot2.outrexx V1.00 (27.11.98)
*/
PARSE ARG ARexxPort;
ADDRESS VALUE ARexxPort;
OPTIONS RESULTS;
FWVorlage = "FWDokumente/Angebot2.fw";
FWDokument = "t:Angebot2.fw";
FWPort = "FINALW."
LF = '0a'x; /* Zeilenvorschub */
Gefunden = 0;
DO i = 1 TO 20 WHILE(Gefunden = 0)
IF show(ports, (FWPort || i)) THEN
DO;
Gefunden = 1;
FWPort = FWPort || i;
END;
END;
IF Gefunden = 0 THEN
DO;
ES_TITLE = "Warnung";
ES_TEXTFORMAT = "FinalWriter ist nicht aktiv, bitte starten sie dieses" || LF || "und versuchen Sie es erneut";
ES_GADGETFORMAT = "Abbrechen";
EASY_REQUEST;
EXIT;
END;
/* Original FW-Dokument nach t: kopieren, um ein versehentliches überschreiben */
/* dieser Vorlage zu verhindern */
GET_REXXPATH;
FWVorlage = MTR_RESULT || FWVorlage;
ADDRESS COMMAND "copy" FWVorlage FWDokument;
/* Oberfläche sperren */
LOCKGUI;
/* Art ermitteln: 0 = Drucken, 1 = Vorschau, 2 = Speichern */
PRINTSTATE;
Druckart = MTR_RESULT;
Ende_Kennzeichen = 'N';
/* Suchen der zu druckenden Daten */
GET_PREFS;
PRINTFIND;
DO WHILE( MTR_RESULT > 0 & Ende_Kennzeichen = 'N');
ADDRESS VALUE FWPort;
SCREENTOFRONT;
CALL DatenAufbereiten;
SELECT;
WHEN Druckart = 0 THEN /* Drucken */
DO;
ADDRESS VALUE FWPort;
PRINT;
ADDRESS VALUE ARexxPort;
MTSCREENTOFRONT;
END;
WHEN Druckart = 1 THEN /* Vorschau */
ADDRESS VALUE ARexxPort;
WHEN Druckart = 2 THEN /* Sichern */
DO;
ADDRESS VALUE FWPort;
SAVEAS;
ADDRESS VALUE ARexxPort;
MTSCREENTOFRONT;
END;
OTHERWISE
DO;
ES_TITLE = "Warnung";
ES_TEXTFORMAT = "Druckart wird nicht unterstützt!";
ES_GADGETFORMAT = "Ok";
EASY_REQUEST;
Ende_Kennzeichen = 'J';
END;
END;
PRINTFIND;
END;
/* WordWorth-Datei aus t: wieder entfernen */
ADDRESS COMMAND "delete" FWDokument;
/* Oberfläche wieder entsperren */
ADDRESS VALUE ARexxPort;
FREEGUI;
EXIT;
DatenAufbereiten:
ADDRESS VALUE ARexxPort;
IF PREFS.NUMBER_DIGITS > 0 THEN
DO;
ZW_Rechnung = RIGHT( (Copies("0",PREFS.NUMBER_DIGITS) || MTR_RESULT), PREFS.NUMBER_DIGITS );
ZW_Kunde = RIGHT( (Copies("0",PREFS.NUMBER_DIGITS) || OB.INVOICEE_NUMBER), PREFS.NUMBER_DIGITS );
END;
ELSE
DO;
ZW_Rechnung = MTR_RESULT;
ZW_Kunde = OB.INVOICEE_NUMBER;
END;
IF PREFS.CLIENT_CODE = 1 THEN
ZW_Kunde = OB.INVOICEE.CUSTOMER.CLIENT_CODE;
FORMAT_DATE_LONG date(s);
PRINTDATE = MTR_RESULT;
FORMAT_DATE_LONG OB.DATE_TENDER;
IF MTR_RESULT = "" THEN
TENDER_DATE_LONG = " ";
ELSE
TENDER_DATE_LONG = MTR_RESULT;
w = OB.CURRENCY_USED;
IF w < 2 THEN
FORMAT_MONEY1 OB.TOTAL_M_ALL_CH.w;
ELSE
FORMAT_MONEY2 OB.TOTAL_M_ALL_CH.w;
ZW_Betrag = MTR_RESULT;
IF w < 2 THEN
FORMAT_MONEY1 OB.DISPATCH_COSTS.w;
ELSE
FORMAT_MONEY2 OB.DISPATCH_COSTS.w;
ZW_Versand = MTR_RESULT;
FORMAT_NUMBER OB.DISCOUNT_PERCENT PREFS.FRAC_DIGITS_PERCENT;
DISP = MTR_RESULT;
IF w < 2 THEN
FORMAT_MONEY1 OB.DISCOUNT.w;
ELSE
FORMAT_MONEY2 OB.DISCOUNT.w;
DIS = MTR_RESULT;
IF w < 2 THEN
FORMAT_MONEY1 OB.TOTAL_M_ALL_CH.0;
ELSE
FORMAT_MONEY2 OB.TOTAL_M_ALL_CH.2;
SUM_NET = MTR_RESULT;
IF w < 2 THEN
FORMAT_MONEY1 OB.TOTAL_M_ALL_CH.1;
ELSE
FORMAT_MONEY2 OB.TOTAL_M_ALL_CH.3;
SUM_GROSS = MTR_RESULT;
ADDRESS VALUE FWPort;
CLEARDOC;
OPEN FWDokument;
DruckString = OB.OFFICE.ADDRESS.ADDRESS.2 || LF;
i = INDEX( DruckString, LF);
IF i > 0 THEN
DO;
DruckTeil = LEFT( DruckString, (i - 1) );
DruckString = SUBSTR(DruckString, (i + 1) );
i = INDEX( DruckString, LF);
END;
ELSE
DruckTeil = DruckString;
FIND "<OFFICE.ADDRESS.2>";
FINDNEXT;
STATUS LinePos;
PARSE VAR RESULT BegLine BegPosition EndLine EndPosition;
TYPE DruckTeil;
FIND "<PRINTDATE>"
TYPE PRINTDATE;
DO WHILE( i > 0 );
DruckTeil = LEFT( DruckString, (i - 1) );
DruckString = SUBSTR(DruckString, (i + 1) );
BegLine = BegLine + 1;
MoveToLine BegLine 0;
TYPE DruckTeil;
i = INDEX( DruckString, LF);
END;
FIND "<OFFICE.ADDRESS.ADDRESS.0>";
TYPE OB.OFFICE.ADDRESS.ADDRESS.0;
FIND "<CUSTOMER.ADDRESS.ADDRESS.2>";
IF OB.INVOICEE_NUMBER = 0 THEN
TYPE "Barverkauf";
ELSE
DO;
STATUS LinePos;
PARSE VAR RESULT BegLine BegPosition EndLine EndPosition;
DruckString = OB.INVOICEE.CUSTOMER.ADDRESS.ADDRESS.2 || LF;
i = INDEX( DruckString, LF);
IF i > 0 THEN
DO;
DruckTeil = LEFT( DruckString, (i - 1) );
DruckString = SUBSTR(DruckString, (i + 1) );
i = INDEX( DruckString, LF);
END;
ELSE
DruckTeil = DruckString;
TYPE DruckTeil;
DO WHILE( i > 0 );
DruckTeil = LEFT( DruckString, (i - 1) );
DruckString = SUBSTR(DruckString, (i + 1) );
BegLine = BegLine + 1;
MoveToLine BegLine 0;
TYPE DruckTeil;
i = INDEX( DruckString, LF);
END;
END;
FIND "<OB.INVOICEE_NUMBER>";
TYPE ZW_Kunde;
FIND "<OB.NUMBER>";
TYPE ZW_Rechnung;
FIND "<OB.DATE_TENDER>";
TYPE TENDER_DATE_LONG;
FIND "<OB.EMPLOYEE.SUR_PRENAME>";
TYPE (OB.EMPLOYEE.ADDRESS.PRENAME OB.EMPLOYEE.ADDRESS.SURNAME);
FIND "<ARTICLE>";
STATUS LinePos;
PARSE VAR RESULT BegLine BegPosition EndLine EndPosition;
BACKSPACE;
DO i = 1 to OB.COUNT_ARTICLE;
ADDRESS VALUE ARexxPort;
ZW_ArtikelNr = OB.i.POS_ARTICLE_NUMBER_FORMATED;
FORMAT_NUMBER (OB.i.POS_QUANTITY / OB.i.POS_PRICE_UNIT) PREFS.FRAC_DIGITS;
ZW_Anzahl = MTR_RESULT;
NAME_OF_QUANTITY_UNIT OB.i.ARTICLE.QUANTITY_UNIT;
ZW_Einheit = MTR_RESULT;
j = OB.i.POS_VALUE;
FORMAT_NUMBER OB.VALUE_PERCENT.j PREFS.FRAC_DIGITS_PERCENT;
ZW_MWSt = MTR_RESULT;
ZW_Bezeichnung = OB.i.ARTICLE.DESCRIPTION;
IF w < 2 THEN
FORMAT_MONEY1 OB.i.POS_SINGLE_PRICE.w;
ELSE
FORMAT_MONEY2 OB.i.POS_SINGLE_PRICE.w;
ZW_EinzelPreis = MTR_RESULT;
ADDRESS VALUE FWPort;
TYPE ZW_ArtikelNr || " " || ZW_Anzahl || " " || ZW_Bezeichnung || " " || ZW_Einheit || " " || ZW_MWSt || " " || ZW_EinzelPreis;
IF OB.i.ARTICLE.ADDITIONAL_TEXT > "" THEN
DO;
DruckString = OB.i.ARTICLE.ADDITIONAL_TEXT || LF;
i2 = INDEX( DruckString, LF);
DO WHILE( i2 > 0 );
DruckTeil = LEFT( DruckString, (i2 - 1) );
DruckString = SUBSTR(DruckString, (i2 + 1) );
BegLine = BegLine + 1;
MoveToLine BegLine 0;
TYPE " " || DruckTeil || " ";
i2 = INDEX( DruckString, LF);
END;
END;
IF OB.i.POS_REMARK > "" THEN
DO;
DruckString = OB.i.POS_REMARK || LF;
i2 = INDEX( DruckString, LF);
DO WHILE( i2 > 0 );
DruckTeil = LEFT( DruckString, (i2 - 1) );
DruckString = SUBSTR(DruckString, (i2 + 1) );
BegLine = BegLine + 1;
MoveToLine BegLine 0;
TYPE " " || DruckTeil || " ";
i2 = INDEX( DruckString, LF);
END;
END;
DO i2 = 0 TO 2;
IF OB.i.POS_ADD_RED_USED.i2 > 0 THEN
DO;
ADDRESS VALUE ARexxPort;
j2 = OB.i.POS_ADD_RED_USED.i2 - 1;
IF OB.i.POS_ADD_RED_TYPE.i2 = 0 | OB.i.POS_ADD_RED_TYPE.i2 = 5 THEN
DO;
FORMAT_NUMBER OB.i.POS_ADD_RED_VALUE.i2.w PREFS.FRAC_DIGITS_PERCENT;
END;
ELSE
DO;
IF w < 2 THEN
FORMAT_MONEY1 OB.i.POS_ADD_RED_VALUE.i2.w;
ELSE
FORMAT_MONEY2 OB.i.POS_ADD_RED_VALUE.i2.w;
END;
ZW_EinzelZuAb = RIGHT(MTR_RESULT, 15);
IF w < 2 THEN
FORMAT_MONEY1 OB.i.POS_ADD_RED_VALUE_POS.i2.w;
ELSE
FORMAT_MONEY2 OB.i.POS_ADD_RED_VALUE_POS.i2.w;
ZW_PosZuAb = RIGHT(MTR_RESULT, 15);
ADDRESS VALUE FWPort;
BegLine = BegLine + 1;
MoveToLine BegLine 0;
TYPE " " || PREFS.ADD_RED_TEXT.j2 || " " || ZW_EinzelZuAb || " " || ZW_PosZuAb;
END;
END;
ADDRESS VALUE ARexxPort;
IF w < 2 THEN
FORMAT_MONEY1 OB.i.POS_SUM_M_ALL.w;
ELSE
FORMAT_MONEY2 OB.i.POS_SUM_M_ALL.w;
ZW_PosPreis = MTR_RESULT;
ADDRESS VALUE FWPort;
TYPE " " || ZW_PosPreis;
BegLine = BegLine + 1;
MoveToLine BegLine 0;
END;
FIND "<DESCRIPTION>";
j2 = 0;
IF OB.REMARK > "" THEN
DO;
DruckString = OB.REMARK || LF;
i2 = INDEX( DruckString, LF);
DO WHILE( i2 > 0 );
DruckTeil = LEFT( DruckString, (i2 - 1) );
DruckString = SUBSTR(DruckString, (i2 + 1) );
IF j2 > 0 THEN
NEWPARAGRAPH;
TYPE DruckTeil;
i2 = INDEX( Dru